﻿<Window x:Class="ISBNScanner.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="420" Width="600">
    <Window.Resources>
        <Style TargetType="Rectangle" x:Key="DetailRotation" >
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=Animate}" Value="true">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard Name="NewAnimation">
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="0:0:1" />
                            </Storyboard>
                        </BeginStoryboard>
                    </DataTrigger.EnterActions>
                </DataTrigger>
            </Style.Triggers>

        </Style>
    </Window.Resources>
    <Grid Background="#c0d0e0">
        <Rectangle Style="{StaticResource DetailRotation}" Opacity="0" >
            <Rectangle.Fill>
                <LinearGradientBrush StartPoint="0.5,0.3" EndPoint="0.5,1" >
                    <GradientStop x:Name="bcolor" Offset="0" Color="{Binding BackgroundColor}"/>
                    <GradientStop Offset="1" Color="Transparent"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
        <Grid Background="Transparent">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="140"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="1" Margin="2" Width="180" Text="{Binding SelectedTitle.Isbn}" FontSize="16"/>
            <ItemsControl Grid.Row="1" Grid.Column="1" Margin="2" ItemsSource="{Binding SelectedTitle.Copies}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel Orientation="Vertical"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding}" Foreground="Black" Margin="8,2,2,2" FontSize="12"/>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

            <Border Grid.Column="0" Grid.RowSpan="2" Padding="2" Background="#e0e8ef">
                <ListBox  Margin="2" ItemsSource="{Binding AllNumbers}" SelectedItem="{Binding SelectedTitle}" >
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Isbn}"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Border>

            <StatusBar Grid.Row="2" Grid.ColumnSpan="2" Height="21" BorderThickness="1" Margin="1" BorderBrush="Gray" >
                <StatusBarItem Content="{Binding Status}"/>
            </StatusBar>
        </Grid>
    </Grid>
</Window>
